﻿using MvcArchStarter.Core.Ioc;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;

namespace MvcArchStarter.Infrastructure.Persistence
{
    public class ConnectionStringContextFactory : IContextFactory
    {
        public string ConnectionString { get; set; }

        public DbContext Create()
        {
            if (string.IsNullOrEmpty(this.ConnectionString))
                throw new ArgumentException("ConnectionString is required!");

            return new MvcArchStarterContext(this.ConnectionString);
        }
    }
}
